package cn.lili.controller.feign;

import cn.lili.modules.promotion.client.TicketOrderClient;
import cn.lili.modules.promotion.entity.dos.TicketOrder;
import cn.lili.modules.promotion.service.TicketOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
public class TicketOrderFeignController implements TicketOrderClient {

    private final TicketOrderService ticketOrderService;

    @Override
    @Transactional
    public void createOrder(TicketOrder ticketOrder) {
        ticketOrderService.createOrder(ticketOrder);
    }

    /**
     * 修改订单状态
     * @param transactionSn 外部订单号
     * @param orderStatus 订单状态
     */
    @Override
    public void updateOrderStatus (String transactionSn, String orderStatus) {
        ticketOrderService.updateOrderStatus(transactionSn, orderStatus);
    }

    @Override
    public List<TicketOrder> getListByTransactionSn(String transactionSn) {
        return ticketOrderService.getListByTransactionSn(transactionSn);
    }
}
